import {useState} from "react";
import {View} from "@tarojs/components";
import Table from "../../../../../components/common/Table";

export default function Tb({list}) {
  console.log('list', list)
  function getInitTable () {
    const arr = list[0] && list[0].errorTypeList && list[0].errorTypeList || []
    return arr.map(item => {
      return {
        errorType: item.name,
        num: item.num
      }
    })
  }
  const [col] = useState([
    {
      name: '错误类型',
      key: 'errorType'
    },
    {
      name: '数量',
      key: 'num'
    },
    {
      name: '占比',
      key: 'zb'
    }
  ])
  const [tableData] = useState(getInitTable())
  return (
    <View>
      <Table col={col} tableData={tableData} />
    </View>
  )
}
